from django.db import models
from utils.BaseModels import BaseModel
from .manager import PreDepositLogManage
from django.contrib.auth import get_user_model
UserModel = get_user_model()


# 预存款操作记录
class PreDepositLog(BaseModel.FullAtBaseModel):
    operationTypeEnum = (
        (1, '预存款'),
        (2, '积分'),
    )
    operationMoney = models.DecimalField('操作金额', max_digits=19, decimal_places=2)
    operationType = models.IntegerField('操作类型', choices=operationTypeEnum, default=1)
    user = models.ForeignKey(UserModel, on_delete=models.CASCADE, verbose_name='会员')

    objects = PreDepositLogManage()

    def __str__(self):
        return self.user.name

    class Meta:
        db_table = 'predeposit'
        verbose_name = '预存款操作记录'
        verbose_name_plural = '预存款操作记录'

